var express = require('express');
var ProductRouter = express.Router();
// 图片上传
const multer = require('multer')
const upload =  multer({dest:'public/productuploads/'}) 

// 引入控制层
const ProductController = require('../../controller/admin/ProductController')

// 添加产品
ProductRouter.post("/adminapi/product/addProduct",upload.single('file'),ProductController.addProduct)
// 获取产品
ProductRouter.get("/adminapi/product/productList",ProductController.productList)
ProductRouter.get("/adminapi/product/productList/:id",ProductController.productList)
// 删除产品
ProductRouter.delete("/adminapi/product/delete/:id",ProductController.deleteProduct)
// 修改商品
ProductRouter.post("/adminapi/product/editProduct",upload.single('file') ,ProductController.updateProduct)


module.exports =  ProductRouter